package com.wuge.springInjection0807;

import com.wuge.springInjection0807.AnimalTest.Animal;
import com.wuge.springInjection0807.Event.MessageEvent;
import com.wuge.springInjection0807.Message.Person;
import com.wuge.springInjection0807.UserTest.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by Administrator on 2017/8/7.
 */
public class Main {
    public static void main(String[] args) {
        //System.out.println("hello world");
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        /*
        Person person = context.getBean("wg", Person.class);
        person.sendMessage();*/

        // 2:AnimalTest
        /*
        Animal animal = (Animal) context.getBean("animal");
        animal.say();*/

        // UserTest
        /*User user = context.getBean("gzUser", User.class);
        System.out.println("userName: " + user.getUserName() + ", money: " + user.getMoney());*/
        MessageEvent event = new MessageEvent("", "my name is gzzzz~");
        context.publishEvent(event);

    }
}
